package Socket;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.nio.charset.StandardCharsets;

public class Server {
    private ServerSocket serverSocket;
    public Server() {
        try {
            System.out.println("正在启动服务器...");
            serverSocket = new ServerSocket(8888);
            System.out.println("服务器已启动...");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public void start(){
        try {
            System.out.println("正在等待客户链接...");
            Socket socket=serverSocket.accept();
            System.out.println("一个客户已链接...");
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
    public static void main(String[] args) {
        Server server=new Server();
        server.start();
    }

}
